const http = require('http')
const domain = require('domain')
const server = http.createServer((rq, rs) => {
  let dm = domain.create()
  dm.add(rq)
  dm.add(rs)
  dm.on('error', (err) => {
    rs.writeHead(200)
    rs.write('客户端发现一错误')
    rs.end(err.message)
  })
  if (rq.url !== '/favicon.ico') {
    rq.setEncoding('utf-8')
    rq.on('data', (data) => {
      rs.writeHead(200)
      console.log('服务器接收到数据', data);
      nofunexits()
      rs.write('hello')
      rs.end()
    })
  }
}).listen(1337, 'localhost', () => {
  console.log(server.address());
})